DISCUSSION
The
ATSUSetSoftLineBreak function enables you to use your own line-breaking algorithm to set soft line break positions in a range of text. You should call
ATSUSetSoftLineBreak to implement word break hyphenation. If you do not want to set line breaks, call the function
ATSUBreakLine and pass
true for the
iUseAsSoftLineBreak parameter.
Before calculating soft line breaks,
ATSUSetSoftLineBreak turns off any previously set line justification, rotation, width alignment, descent, and ascent values and treats the text as a single line. It then examines the text layout object to make sure that the style runs cover the entire range of text. If there are gaps between style runs,
ATSUSetSoftLineBreak assigns the characters in the gap to the style run following the gap. If there is no style run at the beginning of the range of text,
ATSUSetSoftLineBreak assigns these characters to the first style run it can find. If there no style run at the end of the range of text,
ATSUSetSoftLineBreak assigns the remaining characters to the last style run it can find.
After calling
ATSUSetSoftLineBreak, you should call the function
ATSUMeasureText to measure the text.